// 设置通用的下拉选数据--包括级联下拉选数据

import {
  ICommonSelectOptions,
  ICommonSelectOptionsString,
  IJsonCityEntity,
  ICascaderEntity
} from './common-interface'
const jsonCitys: IJsonCityEntity[] = require('@/api/json/china-citys.json')

export const warehouseStatusSelectOptions: ICommonSelectOptions[] = [
  {
    value: -1,
    label: '全部'
  },
  {
    value: 0,
    label: '停用'
  },
  {
    value: 1,
    label: '启用'
  }
]

export const warehouseTypeSelectOptions: ICommonSelectOptionsString[] = [
  {
    value: 'ZZ',
    label: '中转仓'
  },
  {
    value: 'JG',
    label: '加工仓'
  },
  {
    value: 'CB',
    label: '储备仓'
  },
  {
    value: 'LC',
    label: '冷藏仓'
  }
]

// 温度类型
export const temperatureTypeOptions: ICommonSelectOptionsString[] = [
  {
    value: 'CW',
    label: '常温'
  },
  {
    value: 'LC',
    label: '冷藏'
  },
  {
    value: 'HW',
    label: '恒温'
  }
]

// 承重类型
export const bearingTypeOptions: ICommonSelectOptionsString[] = [
  {
    value: 'ZX',
    label: '重型'
  },
  {
    value: 'QX',
    label: '轻型'
  },
  {
    value: 'BX',
    label: '中型'
  }
]

// 用途类型
export const useTypeOptions: ICommonSelectOptionsString[] = [
  {
    value: 'RKHCQ',
    label: '入库缓存区'
  },
  {
    value: 'CKHCQ',
    label: '出库缓存区'
  },
  {
    value: 'CCQ',
    label: '存储区'
  },
  {
    value: 'FJQ',
    label: '分拣区'
  },
  {
    value: 'ZJQ',
    label: '质检区'
  }
]

// 质检方式
export const inspectionTypeOptions: ICommonSelectOptionsString[] = [
  {
    value: 'BCL',
    label: '不质检'
  },
  {
    value: 'QJ',
    label: '全检'
  },
  {
    value: 'CJ',
    label: '抽检'
  }
]
const jsonDataConvert = (
  cityArr: IJsonCityEntity[],
  arr: ICascaderEntity[]
) => {
  cityArr.forEach((item: IJsonCityEntity) => {
    const newItem: ICascaderEntity = {
      label: item.name,
      value: item.code
    }
    if (Array.isArray(item.areaList) && item.areaList.length > 0) {
      newItem.children = []
      jsonDataConvert(item.areaList, newItem.children)
    }
    arr.push(newItem)
  })
}

export const getChinaCascaderData = (): ICascaderEntity[] => {
  const arr: ICascaderEntity[] = []
  jsonDataConvert(jsonCitys, arr)
  return arr
}

// 盘点状态下拉选
export const checkStatusOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '一盘中'
  },
  {
    value: 3,
    label: '一盘完成'
  },
  {
    value: 4,
    label: '复盘中'
  },
  {
    value: 5,
    label: '复盘完成'
  },
  {
    value: 6,
    label: '已取消'
  }
]

// 盘点类型下拉选
export const checkTypeOptions: ICommonSelectOptionsString[] = [
  {
    value: 'SJPD',
    label: ' 随机盘点'
  },
  {
    value: 'JHPD',
    label: '计划盘点'
  }
]

// 盘点原因下拉选
export const checkReasonOptions: ICommonSelectOptionsString[] = [
  {
    value: 'GH',
    label: '规划'
  },
  {
    value: 'HZ',
    label: '货主'
  },
  {
    value: 'CY',
    label: '差异'
  }
]

// 盘点维度下拉选
export const checkDimensionOptions: ICommonSelectOptionsString[] = [
  {
    value: 'KW',
    label: '库位'
  },
  {
    value: 'HP',
    label: '货品'
  }
]

// 出库类型
export const loutTypeOptions: ICommonSelectOptionsString[] = [
  {
    value: '0',
    label: 'B2B'
  }
]
// 盘点任务状态下拉选
export const checkTaskStatusOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '待分配'
  },
  {
    value: 2,
    label: '盘点中'
  },
  {
    value: 3,
    label: '盘点已完成'
  },
  {
    value: 4,
    label: '已生成损益'
  },
  {
    value: 5,
    label: '完成盘点'
  }
]

// 入库单状态下拉选
export const storageInStatusOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '收货中'
  },
  {
    value: 3,
    label: '已取消'
  },
  {
    value: 4,
    label: '收货完成'
  },
  {
    value: 5,
    label: '上架中'
  },
  {
    value: 6,
    label: '上架完成'
  }
]

// 出库状态
export const storageOutStatus: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '拣货中'
  },
  {
    value: 3,
    label: '拣货完成'
  },
  {
    value: 4,
    label: '交接中'
  },
  {
    value: 5,
    label: '交接完成'
  }
]

// 出库状态
export const outPickingStatus: ICommonSelectOptions[] = [
  {
    value: -1,
    label: '全部'
  },
  {
    value: 1,
    label: '待分配'
  },
  {
    value: 2,
    label: '拣货中'
  },
  {
    value: 3,
    label: '拣货完成'
  }
]

// 出库状态
export const outPrincipalStatus: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '张文礼'
  },
  {
    value: 2,
    label: '王千一'
  },
  {
    value: 3,
    label: '徐文'
  },
  {
    value: 4,
    label: '赵文谦'
  }
]

// 收货状态
export const taskReceiveStatusOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '待分配'
  },
  {
    value: 2,
    label: '收货中'
  },
  {
    value: 3,
    label: '收货完成'
  },
  {
    value: 4,
    label: '已取消'
  }
]

// 上架情况
export const taskAddStatusOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '待分配'
  },
  {
    value: 2,
    label: '上架中'
  },
  {
    value: 3,
    label: '上架完成'
  },
  {
    value: 4,
    label: '已取消'
  }
]

// 损益单状态
export const loseProfitStatusOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '已调整'
  }
]

// 入库单入库详情步骤条
export const storageInStepSuccessOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '收货中'
  },
  {
    value: 4,
    label: '收货完成'
  },
  {
    value: 5,
    label: '上架中'
  },
  {
    value: 6,
    label: '上架完成'
  }
]

// 入库单入库详情步骤条
export const storageInStepCancleOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 3,
    label: '已取消'
  }
]

// 盘点单详情步骤条

export const checkStepSuccessOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '一盘中'
  },
  {
    value: 3,
    label: '一盘完成'
  },
  {
    value: 4,
    label: '复盘中'
  },
  {
    value: 5,
    label: '复盘完成'
  }
]
// 盘点单详情步骤条
export const checkStepCancleOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 6,
    label: '已取消'
  }
]

// 盘点单详情步骤条
export const checkStepLoseProfitOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '一盘中'
  },
  {
    value: 3,
    label: '一盘完成'
  }
]

// 盘点单详情步骤条
export const checkSpecIdOptions: ICommonSelectOptions[] = [
  {
    value: 1,
    label: '新建'
  },
  {
    value: 2,
    label: '拣货中'
  },
  {
    value: 3,
    label: '已取消'
  },
  {
    value: 4,
    label: '拣货完成'
  },
  {
    value: 5,
    label: '交接中'
  },
  {
    value: 6,
    label: '交接完成'
  }
]
